<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
form {
	width: 80%;
	margin: auto;
}
.listDiv{
	height:65px;
	border: 1px solid #777b12;
	width:80%;
	display:inline-block;
	border-radius:5px;
	overflow: hidden;
	text-align:center;
	margin-left:10px;
	margin-right:10px;
	background:#F7F5F5;
}
#memberDetailTable{
	border: 0px solid #969696 !important;
}
#memberDetailTable{
	background: #f9f9f9;
}
#memberDetailTable tr:nth-child(odd) td,
#memberDetailTable tr:nth-child(odd) th {
    background-color: #f9f9f9;
}
#memberDetailTable td {
	text-align: left !important;
}

</style>
<script type="text/javascript">
	$().ready(function() {
		disableExitMenu();
		$("#customerEmplpyees").click(function(){
			var html = "<ul>";
			$("#customerEmplpyeesHide").find("option").each(function(id,op){
				html += "<li>" + op.text +"</li>";
			 }); 
			html += "</ul>";
			global.alert(html);
		});
		$("#customerCares").click(function(){
			var html = "<ul>";
			$("#customerCaresHide").find("option").each(function(id,op){
				html += "<li>" + op.text +"</li>";
			 }); 
			html += "</ul>";
			global.alert(html);
		});
	});

	function disableExitMenu() {
		$("#header").delegate("a", "click", function(e) {
			if ("${member.menuState.emptyShopping}" == "false") {
				$(this).attr("href", "#");
			} else {
				$(this).attr("href", "#dialog-menu");
			}
		});
	}

	function dropShopping() {
		if ("${member.menuState.emptyShopping}" == "false") {
			// 自定义按钮
			global
					.confirm(
							"确定要返回，返回后，已添加的数据将被丢弃？",
							function() {
								window.location.href = "${ctx}/cash/member/dropShopping?memberID=${member.customer.id}";
							});//confirm

		} else {
			window.location.href = "${ctx}/cash/member/dropShopping?memberID=${member.customer.id}";

		}

	}
	function showCustomerDetail() {
		sessionStorage.target = "cash";
		var url = "${ctx}/base/customer/detail?id=${member.customer.id}";
		window.location.href = url;
	}
</script>

<title>会员消费</title>
<meta name="decorator" content="default" />
</head>
<body>
	<div class="container">
		<tags:message content="${message}" />
		<form action="" id="memberInfo" action="#" method="post"
			class="form-input">
			<div class="ui-grid-c">
			<div class="ui-block-a">
				 
			</div>
			<div class="ui-block-b">
				 
			</div>
			<div class="ui-block-c">
				 
			</div>
			<div class="ui-block-d">
				 
			</div>
		</div>
		<table id="memberDetailTable" border="0" width="100%">
			<tr>
				<td width="35%">
					<label>客户姓名&nbsp;:&nbsp;</label>
					<input type="text" value="${ member.customer.name}" maxlength="16" class="required" readonly />
				</td>
				<td colspan="2">
					<label>上次到店时间&nbsp;：&nbsp;</label>
					<input type="text" value="${fns:formatDate(member.historyConsumes[0].consume_Time,'yyyy-MM-dd HH:mm:ss')}" maxlength="16" class="required" readonly /><br/>
				</td>
			</tr>
			<tr>
				<td width="35%">
					<label>备注名&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;</label>
					<input type="text" value="${ member.customer.nickname}" maxlength="16" class="required" readonly />
				</td>
				<td rowspan="2" width="30%">
					<label>专属美容师:</label>
					<div id="customerEmplpyees" class="listDiv">
						<c:forEach items="${member.customerEmployeeRelationships}" var="ce" step="1" begin="0" end="1">
							${ce.employee.name}<br/>
						</c:forEach>
						<c:if test="${fn:length(member.customerEmployeeRelationships) > 2}">
							...<br/>
						</c:if>
					</div>
				</td>
				<td rowspan="2"  width="30%">
					<label>护理项目:</label>
					<div id="customerCares" class="listDiv">
						<c:forEach items="${member.inprogressCares}" var="ic" step="1" begin="0" end="1">
							<c:if test="${ic.care_type == 0}">
								${ic.care.name}
							</c:if>
							<c:if test="${ic.care_type == 1}">
								${ic.storeSelfCare.name}
							</c:if>
							<br/>
							<c:if test="${fn:length(member.inprogressCares) > 2}">
								...<br/>
							</c:if>
						</c:forEach>
					</div>
					<div  class="hide">
						<select id="customerEmplpyeesHide">
							<c:forEach items="${member.customerEmployeeRelationships}" var="ce">
								<option value="${ce.employee.id}">${ce.employee.name}</option>
							</c:forEach>
						</select>
						<select id="customerCaresHide">
							<c:forEach items="${member.inprogressCares}" var="ic">
								<option value="${ic.id}">
									<c:if test="${ic.care_type == 0}">
										${ic.care.name}
									</c:if>
									<c:if test="${ic.care_type == 1}">
										${ic.storeSelfCare.name}
									</c:if>
								</option>
							</c:forEach>
						</select>
					</div>
				</td>
			</tr>
			<tr>
				<td width="35%">
					<label>手机号码&nbsp;:&nbsp;</label>
					<input type="text" value="${ member.customer.mobile}" maxlength="16" class="required" readonly />
				</td>
			</tr>
		</table>
		</form>
		<form action="" class="form-input" method="post">
			<div class="icon-buttons">
				<input type="button" data-inline="true" data-icon="back"
					onclick="return dropShopping()" data-iconpos="notext" value=" 返回" />
			</div>
		</form>
		<div class="ui-grid-a">
			<div class="ui-block-a">
				<a href="" onclick="showCustomerDetail()" data-role="button"
					${member.menuState.hasDebt?'class=ui-disabled':''}>客户信息</a>
			</div>
			<div class="ui-block-b">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/repayment/debt?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.hasDebt?'':'class=ui-disabled'}>还款</a>
			</div>
		</div>
		<div class="ui-grid-a">
			<div class="ui-block-a">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/cards/new?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.hasDebt?'class=ui-disabled':''}>新开卡</a>
			</div>
			<div class="ui-block-b">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/recharge/cardtimes?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.canRecharge?'':'class=ui-disabled'}>充值</a>
			</div>
		</div>
		<div class="ui-grid-a">
			<div class="ui-block-a">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/product?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.hasDebt?'class=ui-disabled':''}>购买产品</a>
			</div>
			<div class="ui-block-b">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/care?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.hasDebt?'class=ui-disabled':''}>手工护理 </a>
			</div>
		</div>
		<div class="ui-grid-a">
			<div class="ui-block-a">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/member/gift/systemProduct/page?id=${member.customer.id}')"
					data-role="button"
					${member.menuState.hasDebt?'class=ui-disabled':''}>赠品 </a>
			</div>
			<div class="ui-block-b">
				<a href=""
					onclick="directOpenURL('${ctx}/cash/oldcard/cards/add?id=${member.customer.id}')"
					data-role="button">添加老会员卡</a>
			</div>
		</div>
		<div class="ui-grid-solo">
			<c:if test="${member.menuState.emptyShopping}">
					<a href="#" class="ui-disabled" data-role="button">购物车为空</a>
				</c:if>
				<c:if test="${!member.menuState.emptyShopping}">
					<a href=""
						onclick="directOpenURL('${ctx}/cash/member/shoppingDetails?id=${member.customer.id}')"
						${member.menuState.hasDebt?'class=ui-disabled':''}
						data-role="button">购物里有未结账消费，请点击此处统一结账</a>
			</c:if>
		</div>
	</div>

</body>
</html>
